Dashboard

Row

Row

Confirmed cases of COVID-19 in England

---
title: "COVID-19"
output: 
  flexdashboard::flex_dashboard:
    orientation: rows
    social: menu
    source_code: embed
---

```{r setup, include=FALSE}
library(tidyverse) ; library(sf) ;  library(htmlwidgets) ; library(htmltools) ; library(leaflet) ; library(leaflet.extras)

# Area based coronavirus cases 
cases <- read_csv("https://www.arcgis.com/sharing/rest/content/items/b684319181f94875a6879bbc833ca3a6/data") %>% 
  select(area_code = GSS_CD, TotalCases) 

cases_by_area <- st_read("data/utla.geojson") %>% 
  left_join(cases, by = "area_code") %>% 
  mutate(popup = str_c("", area_name, "
", TotalCases, " cases") %>% map(HTML)) ``` Dashboard ======================================================================= Row ----------------------------------------------------------------------- ### ### Row ----------------------------------------------------------------------- ### ### Confirmed cases of COVID-19 in England ```{r} leaflet() %>% setView(-1.464854, 52.561928, zoom = 6) %>% addTiles(urlTemplate = "", attribution = 'Contains OS data © Crown copyright and database right (2020) | Data: Public Health England') %>% addPolygons(data = cases_by_area, fillColor = "#EAEAEA", fillOpacity = 0.3, weight = 1, color = "#bdbdbd") %>% addCircleMarkers(data = cases_by_area, lng = ~long, lat = ~lat, radius = ~sqrt(TotalCases), fillColor = "#2B557A", fillOpacity = 0.8, weight = 1, color = "#FFFFFF", opacity = 1, label = ~popup) %>% addFullscreenControl() %>% addResetMapButton() %>% onRender( "function(el, t) {var myMap = this;myMap._container.style['background'] = '#ffffff';}", paste0("function(el, x) {$('head').append(","\'\'",");}")) ```